#ifndef SIMPLE_ITEM_H
#define SIMPLE_ITEM_H

#define ITEM_MAX_LEN   64
#define ITEM_MAX_COUNT 200
#define ITEM_INTEGER_INVALID -9999
#define ITEM_START_KEY "item.start"
#define ITEM_END_KEY "item.end"

typedef void (*do_item)(const char *key, const char *val);

// return 1 when equal, 0 inequal
extern int item_equal(const char *item, const char *value, int section);
// retun 0 if key item exists, < 0 no exists, buf size should at least ITEM_MAX_LEN
extern int item_string(char *buf, const char *item, int section);

extern int item_integer(const char *item, int section);
extern int item_init(const char *buff);
extern int item_dump(void);
extern void item_traverse(do_item action);

#ifdef ANDROID_BUILD
extern void item_init_from_file(const char *path);
#endif

#define ITEM_DEV_TEST  // this option should be used in early development
#ifdef ITEM_DEV_TEST 
int item_dev_test_init(void);
void item_dev_test_exit(void);
#endif
#endif